Skip to content

fix(clerk-js): Don't render switch button on default plans#8116

Merged
brkalow merged 1 commit intorelease/core-2from
ds.fix/core-2-default-switch
Mar 19, 2026
Merged

fix(clerk-js): Don't render switch button on default plans#8116
brkalow merged 1 commit intorelease/core-2from
ds.fix/core-2-default-switch

Conversation

@dstaley
Copy link
Member

@dstaley dstaley commented Mar 18, 2026

Description

This PR fixes an issue where a "Manage Subscription" button appeared on default free plans when another plan was switched to annual. This PR updates the logic to calculate whether a period switch is allowed by factoring in the is_default property of the subscription's plan.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@dstaley dstaley requested a review from a team March 18, 2026 22:13
@changeset-bot
Copy link

changeset-bot bot commented Mar 18, 2026

🦋 Changeset detected

Latest commit: ebf8d8f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Mar 18, 2026 10:13pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d9563b52-6ec3-4769-a1bf-cf0601963d67

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ds.fix/core-2-default-switch
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can disable sequence diagrams in the walkthrough.

Disable the reviews.sequence_diagrams setting to disable sequence diagrams in the walkthrough.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 18, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@8116

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8116

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8116

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8116

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8116

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@8116

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@8116

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@8116

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8116

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8116

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8116

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8116

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8116

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8116

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@8116

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8116

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@8116

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8116

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8116

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8116

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@8116

@clerk/types

npm i https://pkg.pr.new/@clerk/types@8116

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8116

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8116

commit: ebf8d8f

const isSwitchingPaidPeriod =
!subscription.plan.isDefault &&
planPeriod !== subscription.planPeriod &&
((planPeriod === 'annual' && Boolean(plan.annualMonthlyFee)) || (planPeriod === 'month' && Boolean(plan.fee)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Looks like you fixed something additional here? Could you give a bit more context?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh sorry, that branch was checking planPeriod === 'annual' && Boolean(plan.annualMonthlyFee) (so, the desired plan period is annual and the plan has an annual monthly fee). I added the planPeriod === 'monthly' && Boolean(plan.fee) to account for annual-only plans.

@brkalow brkalow merged commit 9ab0219 into release/core-2 Mar 19, 2026
42 of 45 checks passed
@brkalow brkalow deleted the ds.fix/core-2-default-switch branch March 19, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants